# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=grilo-plugins
pkgver=0.3.13
pkgrel=2
epoch=1
pkgdesc="A collection of plugins for the Grilo framework"
url="https://gitlab.gnome.org/GNOME/grilo-plugins"
arch=(x86_64)
license=(LGPL)
depends=(grilo lua libmediaart libgdata tracker3 gom libdmapsharing chromaprint
         gst-plugins-bad gmime3)
makedepends=(git meson gperf yelp-tools)
checkdepends=(gst-plugins-good gst-plugins-base python-gobject tracker3-miners)
optdepends=('dleyna-server: DLNA plugin'
            'tracker3-miners: Tracker plugin')
groups=(gnome)
_commit=660041b7b6460bbe4becef1b675f4f96189cba2b  # tags/grilo-plugins-0.3.13^0
source=("git+https://gitlab.gnome.org/GNOME/grilo-plugins.git#commit=$_commit"
        0001-grl-lua-factory-Remove-a-bad-pop.patch)
sha256sums=('SKIP'
            '0ee8e2e0810f7e6b5b2c858a98b432e98c4a43e5d1134afb31a17be7f42a3612')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^grilo-plugins-//;s/-/+/g'
}

prepare() {
  cd $pkgname

  # Fix bug exposed by Lua 5.4.3
  git apply -3 ../0001-grl-lua-factory-Remove-a-bad-pop.patch
}

build() {
  arch-meson $pkgname build -D enable-tracker=no
  meson compile -C build
}

check() {
  dbus-run-session meson test -C build --print-errorlogs
}

package() {
  depends+=(libgr{ilo,lnet,lpls}-0.3.so)
  DESTDIR="$pkgdir" meson install -C build
}
